home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3271 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.4 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.lang.eiffel
  4. Subject: Re: Hungarian notation
  5. Date: 22 Jan 1996 22:15:36 -0600
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4e1nd8$hv0@solutions.solon.com>
  8. References: <30C40F77.53B5@swsbbs.com> <4d2ok0$69s@beach.and.nl> <4dtv3gINNo9u@keats.ugrad.cs.ubc.ca> <SPENCER.96Jan22113215@zorgon.ERA.COM>
  9. NNTP-Posting-Host: solutions.solon.com
  10.  
  11. In article <SPENCER.96Jan22113215@zorgon.ERA.COM>,
  12. Spencer Allain <spencer@ERA.COM> wrote:
  13. >It is incorrect to say that a 'char' (of size 1 byte on many systems)
  14. >and an 'int' (of size 4 bytes on many systems) is structurally
  15. >equivalent, yet I must be able to compile this without errors:
  16. >(warnings are _not_ errors -- though I get none compiling this anyway)
  17.  
  18. >   char a;
  19. >   int b;
  20.  
  21. >   int main()
  22. >   {
  23. >     b = -154267 ;
  24. >     a = b ;
  25. >     return 0 ;
  26. >   }
  27.  
  28. No warnings, perhaps, but undefined behavior unless CHAR_MIN is
  29. less than or equal to -154267.
  30.  
  31. And yes, we know C intentionally gives up some type safety for being
  32. easy to compile.
  33.  
  34. :)
  35.  
  36. -s
  37. -- 
  38. Peter Seebach - seebs@solon.com - Copyright 1995 Peter Seebach.
  39. C/Unix proto-wizard -- C/Unix questions? Send mail for help.  No, really!
  40. Using trn?  Weird new newsgroup problem?  I know the fix!  Email me!
  41. The *other* C FAQ - ftp taniemarie.solon.com /pub/c/afq - Not A Flying Toy
  42.